Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents | Next

The Preview Resource

QuickTime uses the preview resource (defined by the pnotResource data type) with a resource ID of 0 to store the visual preview information. The structure of the preview resource is shown in Listing 3 .

If you parse this resource directly, please do extensive error checking in your code so as not to hinder future expansion of the data structure. In particular, if you encounter unknown version bits, exercise caution. Unexpected results may occur.

Listing 3 The preview resource

typedef struct pnotResource {
    unsigned long       modDate;        /* modification date */
    short               version;        /* version number of preview
                                            resource */
    OSType              resType;        /* type of resource used as preview
                                            cache */
    short               resID;          /* resource identification number
                                            of resource used as preview
                                            cache */
    short               numResItems;/* number of additional file
                                            descriptions */
    pnotResItem         resItem[ ];     /* array of file descriptions */
} pnotResource;
modDate
Contains the modification time (in standard Macintosh seconds since midnight, January 1, 1904) of the file for which the preview was created. This parameter allows you to find out if the preview is out of date with the contents of the file.
version
Contains the version number of the preview resource. The low bit of the version is a flag for preview components that only reference their data. If the bit is set, it indicates that the resource identified in the preview resource is not owned by the preview component, but is part of the file. It is not removed when the preview is updated or removed (using the Image Compression Manager's MakeFilePreview or AddFilePreview function), as it would be if the version number were 0.
resType
Contains the type of a resource used as a preview cache for the given file. The type of the resource determines the subtype of the preview component that should be used to display the preview.
resID
Contains the identification number of a resource used as a preview cache for the specified file.
numResItems
Specifies the number of additional file descriptions stored with this preview.
resItem
Contains the preview resource item structure (defined by the pnotResItem data type), which is described next.

© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next